From 9b88fe0b59e2601fa7de0256f7028b3eaffd1659 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Tue, 16 Sep 2014 15:58:29 +0000 Subject: [PATCH] blanket replace of gbfprintf arguments using .toUtf8().data() to avoid potential deep copies. --- gpsbabel/delbin.cc | 8 ++++---- gpsbabel/html.cc | 4 ++-- gpsbabel/text.cc | 2 +- gpsbabel/tiger.cc | 2 +- gpsbabel/vcf.cc | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gpsbabel/delbin.cc b/gpsbabel/delbin.cc index 536d64a91..0284711ef 100644 --- a/gpsbabel/delbin.cc +++ b/gpsbabel/delbin.cc @@ -1205,7 +1205,7 @@ get_gc_notes(const Waypoint* wp, int* symbol, char** notes, unsigned* notes_size if (!wp->description.isEmpty()) { gbfputs(wp->description, fd); if (!wp->gc_data->placer.isEmpty()) { - gbfprintf(fd, " by %s", wp->gc_data->placer.toUtf8().data()); + gbfprintf(fd, " by %s", CSTR(wp->gc_data->placer)); } gbfputc('\n', fd); } @@ -1215,7 +1215,7 @@ get_gc_notes(const Waypoint* wp, int* symbol, char** notes, unsigned* notes_size gbfprintf(fd, "%s\n", waypoint_symbol(gc_sym)); *symbol = gc_sym; } else if (!wp->icon_descr.isNull()) { - gbfprintf(fd, "%s\n", wp->icon_descr.toUtf8().data()); + gbfprintf(fd, "%s\n", CSTR(wp->icon_descr)); } switch (wp->gc_data->container) { case gc_micro: @@ -1257,7 +1257,7 @@ get_gc_notes(const Waypoint* wp, int* symbol, char** notes, unsigned* notes_size gbfprintf(fd, "/T%u\n", wp->gc_data->terr / 10); } if (!wp->gc_data->hint.isEmpty() && !opt_hint_at_end) { - gbfprintf(fd, "HINT: %s\n", wp->gc_data->hint.toUtf8().data()); + gbfprintf(fd, "HINT: %s\n", CSTR(wp->gc_data->hint)); } if (!wp->gc_data->desc_short.utfstring.isEmpty() || !wp->gc_data->desc_long.utfstring.isEmpty()) { gbfputs("DESC: ", fd); @@ -1312,7 +1312,7 @@ get_gc_notes(const Waypoint* wp, int* symbol, char** notes, unsigned* notes_size } } if (!wp->gc_data->hint.isEmpty() && opt_hint_at_end) { - gbfprintf(fd, "\nHINT: %s\n", wp->gc_data->hint.toUtf8().data()); + gbfprintf(fd, "\nHINT: %s\n", CSTR(wp->gc_data->hint)); } gbfputc(0, fd); *notes_size = fd->memlen; diff --git a/gpsbabel/html.cc b/gpsbabel/html.cc index 8655cdaab..6d7f295b0 100644 --- a/gpsbabel/html.cc +++ b/gpsbabel/html.cc @@ -104,13 +104,13 @@ html_disp(const Waypoint* wpt) if (wpt->HasUrlLink()) { char* d = html_entitize(CSTRc(wpt->description)); UrlLink link = wpt->GetUrlLink(); - gbfprintf(file_out, "%s", link.url_.toUtf8().data(), d); + gbfprintf(file_out, "%s", CSTR(link.url_), d); xfree(d); } else { gbfprintf(file_out, "%s", CSTRc(wpt->description)); } if (!wpt->gc_data->placer.isEmpty()) { - gbfprintf(file_out, " by %s", wpt->gc_data->placer.toUtf8().data()); + gbfprintf(file_out, " by %s", CSTR(wpt->gc_data->placer)); } } gbfprintf(file_out, "

\n"); diff --git a/gpsbabel/text.cc b/gpsbabel/text.cc index a0a8e7758..f908fa599 100644 --- a/gpsbabel/text.cc +++ b/gpsbabel/text.cc @@ -132,7 +132,7 @@ text_disp(const Waypoint* wpt) if (wpt->description != wpt->shortname) { gbfprintf(file_out, "%s", CSTRc(wpt->description)); if (!wpt->gc_data->placer.isEmpty()) { - gbfprintf(file_out, " by %s", wpt->gc_data->placer.toUtf8().data()); + gbfprintf(file_out, " by %s", CSTR(wpt->gc_data->placer)); } } if (wpt->gc_data->terr) { diff --git a/gpsbabel/tiger.cc b/gpsbabel/tiger.cc index 18a65fae2..702d13df6 100644 --- a/gpsbabel/tiger.cc +++ b/gpsbabel/tiger.cc @@ -210,7 +210,7 @@ tiger_disp(const Waypoint* wpt) } } - gbfprintf(file_out, "%f,%f:%s", lon, lat, pin.toUtf8().data()); + gbfprintf(file_out, "%f,%f:%s", lon, lat, CSTR(pin)); if (!nolabels) { QString temp; QString desc = csv_stringclean(wpt->description, ":"); diff --git a/gpsbabel/vcf.cc b/gpsbabel/vcf.cc index 09343aa00..3834c2af4 100644 --- a/gpsbabel/vcf.cc +++ b/gpsbabel/vcf.cc @@ -108,7 +108,7 @@ vcf_disp(const Waypoint* wpt) if (wpt->HasUrlLink()) { UrlLink link = wpt->GetUrlLink(); - gbfprintf(file_out, "URL:%s\n", link.url_.toUtf8().data()); + gbfprintf(file_out, "URL:%s\n", CSTR(link.url_)); } gbfprintf(file_out, "NOTE:"); -- 2.30.2